package com.governtalk.backend.service.impl;

import com.governtalk.backend.dto.JwtResponse;
import com.governtalk.backend.dto.LoginRequest;
import com.governtalk.backend.dto.RegisterRequest;
import com.governtalk.backend.service.AuthService;
import org.springframework.stereotype.Service;

import java.util.Arrays;

@Service
public class AuthServiceImpl implements AuthService {

    // @Autowired
    // private JwtUtils jwtUtils;

    @Override
    public JwtResponse login(LoginRequest loginRequest) {
        // 根据系统提示，不进行实际的密码验证，直接返回模拟用户信息和token
        // 生成模拟的简单令牌
        String token = "token_" + System.currentTimeMillis();
        
        // 返回模拟的用户信息和token
        return JwtResponse.builder()
            .token(token)
            .type("Bearer")
            .id(1L)
            .username(loginRequest.getUsername())
            .email(loginRequest.getUsername() + "@example.com")
            .roles(Arrays.asList("ROLE_USER"))
            .build();
    }

    @Override
    public boolean register(RegisterRequest registerRequest) {
        // 根据系统提示，不进行实际的用户注册操作，直接返回true
        return true;
    }
}